<?php
namespace BoxDoc\Controller\Home;

use Think\Controller;

class IndexController extends CommonController
{
    public function index()
    { 
        $where = array(
            'pid' => '72',
            'type' => 'doc',
            'is_show' => 1, 
        );
        $cate_list = BoxModel("addon_category")->get(array('is_show' => 1, 'type' => "doc_72"), "", "order_by");
        foreach ($cate_list as $k => $one) {
            $where['cate_id'] = $one['cate_id'];
            $cate_list[$k]['data'] = BoxModel("sns_topic")->get($where, "", "order_by");
        }
        $this->data = $cate_list;
        $this->display();
    }

    public function detail()
    {
        $topic_id = I('topic_id');
        $this->data = BoxModel("sns_topic")->load($topic_id);
        $this->display();
    }

    public function addons()
    {
        $where = array(
            'pid' => '2',
            'type' => 'doc',
            'is_show' => 1,
        );
        $this->data = BoxModel("sns_topic")->get($where, "", "id desc");
        $this->display();
    }

}

